using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Model.Database;

namespace Model.Mapping
{
    public class DataDictionaryItemMap : EntityTypeConfiguration<DataDictionaryItem>
    {
        public DataDictionaryItemMap()
        {
            // Primary Key
            this.HasKey(t => t.DataDictionaryItemId);

            // Properties
            this.Property(t => t.Text)
                .IsRequired()
                .HasMaxLength(25);

            this.Property(t => t.Description)
                .HasMaxLength(25);

            // Table & Column Mappings
            this.ToTable("DataDictionaryItem");
            this.Property(t => t.DataDictionaryItemId).HasColumnName("DataDictionaryItemId");
            this.Property(t => t.DataDictionaryHeadId).HasColumnName("DataDictionaryHeadId");
            this.Property(t => t.Text).HasColumnName("Text");
            this.Property(t => t.Disable).HasColumnName("Disable");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Sort).HasColumnName("Sort");
            this.Property(t => t.AddTime).HasColumnName("AddTime");
            this.Property(t => t.ModifyTime).HasColumnName("ModifyTime");
        }
    }
}
